<?php

/**
 * This is the model class for table "tbl_xlogrec".
 *
 * The followings are the available columns in table 'tbl_xlogrec':
 * @property string $id
 * @property string $transdate
 * @property string $entryid
 * @property string $invoice
 * @property double $amount
 * @property string $transid
 * @property string $memo
 * @property integer $counter
 * @property string $custno
 */
class Xlogrec extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Xlogrec the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_xlogrec';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id', 'safe'),
			array('counter', 'numerical', 'integerOnly'=>true),
			array('amount', 'numerical'),
			array('id, entryid, transid', 'length', 'max'=>36),
			array('invoice', 'length', 'max'=>10),
			array('custno', 'length', 'max'=>7),
			array('transdate, memo', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, transdate, entryid, invoice, amount, transid, memo, counter, custno', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'transdate' => 'Transdate',
			'entryid' => 'Entryid',
			'invoice' => 'Invoice',
			'amount' => 'Amount',
			'transid' => 'Transid',
			'memo' => 'Memo',
			'counter' => 'Counter',
			'custno' => 'Custno',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id,true);
		$criteria->compare('transdate',$this->transdate,true);
		$criteria->compare('entryid',$this->entryid,true);
		$criteria->compare('invoice',$this->invoice,true);
		$criteria->compare('amount',$this->amount);
		$criteria->compare('transid',$this->transid,true);
		$criteria->compare('memo',$this->memo,true);
		$criteria->compare('counter',$this->counter);
		$criteria->compare('custno',$this->custno,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}